package com.yidu.BusinessParament.mapper;

import com.yidu.BusinessParament.entity.Plate;
import com.yidu.BusinessParament.entity.Security;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * 证券信息数据库sql语句
 * @author :yimeng
 * @date :2022/12/5  16:23
 * @description:some description
 */
@Mapper
public interface SecurityMapper {
    //普通查询语句
    @Select("SELECT * FROM SECURITY")
    List<Security> selectSecurity(Map map);

    //根据条件strWhere，分页模糊查询总行数
    @Select("select count(*) from security where 1=1 ${strWhere}")
    int countSecurity(Map map);

    //根据条件strWhere，分页模糊查询语句
    @Select("select * from security where 1=1 ${strWhere} limit #{page},#{limit}")
    List<Security> limitSecurity(Map map);


    //添加证券信息
    @Insert("INSERT INTO SECURITY VALUES(#{securityId},#{securityName},#{releaseDate},#{delayDate},#{securityType},#{exchangeName},#{plateId},#{Remark})")
    int insertSecurity(Security security);

    //修改证券信息
    @Update("update SECURITY set securityName=#{securityName},releaseDate=#{releaseDate},delayDate=#{delayDate}," +
            "securityType=#{securityType},exchangeName=#{exchangeName},plateId=#{plateId},Remark=#{Remark} where securityId=#{securityId}")
    int updateSecurity(Security security);

    //根据证券编号进行单个删除
    @Delete("delete from security where securityId=#{securityId}")
    int deleteSecurity(String securityId);

    //批量删除
//    @Delete("DELETE FROM SECURITY WHERE securityId IN (#{securityId})")
    int deleteMoreSecurity(List securityId);

}
